package com.serviceImpl;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Random;

import javax.annotation.Resource;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mapper.AutoTradeMapper;
import com.mapper.TradeMapper;
import com.mapper.UsersMapper;
import com.pojo.platform;
import com.service.AutoTradeService;
import com.service.TradeService;

import fun.pub;

@Service(value = "autoTradeService")
public class AutoTradeServiceImpl implements AutoTradeService {
	@Resource
	private AutoTradeMapper autoTradeMapper;

	@Override
	public void insertseletion(HashMap<String, Object> autoaaa) {
		// TODO Auto-generated method stub
		autoTradeMapper.insertselet1(autoaaa);
		
		
		BigDecimal openprice=autoTradeMapper.tradestatis7();//每五分钟的开盘价
		System.out.println("开盘价"+openprice);
		BigDecimal onontime=autoTradeMapper.tradestatis();//搜索每天开盘价
		System.out.println("onontime"+onontime);
		BigDecimal close=autoTradeMapper.tradestatis8();//每五分钟的收盘价
		BigDecimal max=autoTradeMapper.tradestatis81();//每五分钟的max
		System.out.println("42"+max);
		BigDecimal min=autoTradeMapper.tradestatis82();//每五分钟的min
		System.out.println("这里是42");
		HashMap<String, Object> sstatis = new HashMap<String, Object>();
		sstatis.put("openprice", openprice);
		sstatis.put("closeprice", close);
		sstatis.put("maxprice", max);
		sstatis.put("minprice", min);
		sstatis.put("onontime", onontime);

	   String ontime=pub.getOntime();
		sstatis.put("ontime",ontime);
		String titi=autoTradeMapper.tradestatis9(ontime);
		if(titi!=null)
			autoTradeMapper.tradestatis11(sstatis);
		else
			autoTradeMapper.tradesstatisinfo(sstatis);//<!--插入统计数据  -->
		
	}

}
